package logic

import (
	"context"

	"go-weixin/app/music/musicrpc/internal/domain"
	"go-weixin/app/music/musicrpc/internal/svc"
	"go-weixin/app/music/musicrpc/pb/proto/music"

	"github.com/zeromicro/go-zero/core/logx"
)

type MusicDeleteLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
	musicDomain *domain.MusicDomain
}

func NewMusicDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MusicDeleteLogic {
	return &MusicDeleteLogic{
		ctx:         ctx,
		svcCtx:      svcCtx,
		Logger:      logx.WithContext(ctx),
		musicDomain: domain.NewMusicDomain(*svcCtx.ChenDb),
	}
}

func (l *MusicDeleteLogic) MusicDelete(in *music.MusicDeleteReq) (*music.MusicDeleteResp, error) {
	err := l.musicDomain.MusicDelete(in.Md5)
	if err != nil {
		return nil, err
	}
	return &music.MusicDeleteResp{}, nil
}
